package micropascalcomp;

/**
 * Storage class for a token returned by a FSA for a given piece of grammar.
 * @author Jason Welch, Codi Gann, Jamal Martin
 */
public class MP_Token {
    private Token token;                //enumerated token value
    private String lexeme;              //lexeme string name
    private int lineNum, columnNum;     //line and column nuber the token is found at
    
    /**
     * Constructor for token class, does nothing other than store the incoming values
     */
    public MP_Token(Token token, String lexeme, int lineNum, int columnNum){
        this.token = token;
        this.lexeme = lexeme;
        this.lineNum = lineNum;
        this.columnNum = columnNum;
    }
    
    /**
     * Method that returns the token's enumerated value.
     * @return int :: The token's enumerated value.
     */
    public int getToken(){
        return token.ordinal();
    }
    
    /**
     * Method that returns the token's name as a string.
     * @return Token  :: The token's name converted to string from the Enum list.
     */
    public Token getTokenByName(){
        return token;
    }
    
    /**
     * Method that returns the token's lexeme.
     * @return String :: The stored lexeme.
     */
    public String getLexeme(){
        return lexeme;
    }
    
    /**
     * Method that returns the token's line number position in the file.
     * @return int :: The line number that the token exists on.
     */
    public int getLineNum(){
        return lineNum;
    }
    
    /**
     * Method that returns the token's column number position for the given line.
     * @return int :: The column position that the token exists at.
     */
    public int getColumnNum(){
        return columnNum;
    }
}
